package com.ikingtech.platform.service.system.user.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ikingtech.platform.service.system.user.entity.UserCategoryDO;
import com.ikingtech.platform.service.system.user.mapper.UserCategoryMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author tie yan
 */
@Service
@RequiredArgsConstructor
public class UserCategoryService extends ServiceImpl<UserCategoryMapper, UserCategoryDO> {

    public boolean existByUserId(String userId) {
        return this.baseMapper.exists(Wrappers.<UserCategoryDO>lambdaQuery().eq(UserCategoryDO::getUserId, userId));
    }

    public List<UserCategoryDO> listByUserId(String userId) {
        return this.list(Wrappers.<UserCategoryDO>lambdaQuery().eq(UserCategoryDO::getUserId, userId));
    }

    public List<UserCategoryDO> listByUserIds(List<String> userIds) {
        return this.list(Wrappers.<UserCategoryDO>lambdaQuery().in(UserCategoryDO::getUserId, userIds));
    }
}
